using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL
{

    /// <summary>
    /// The StudentFeePaymentTransactionTableManager class is responsible for managing BO.StudentFeePaymentTransactionTable objects in the system.
    /// </summary>
    [DataObjectAttribute()]
    public class StudentFeePaymentTransactionTableManager
    {

        #region "Public Methods"

        /// <summary>
        /// Gets a list with all StudentFeePaymentTransactionTable objects in the database.
        /// </summary>
        /// <returns>A list with all StudentFeePaymentTransactionTable from the database when the database contains any, or null otherwise.</returns>
        [DataObjectMethod(DataObjectMethodType.Select, true)]
        public static StudentFeePaymentTransactionTableList GetList(int StudentFeeKey, int PaymentRefKey)
        {
            return StudentFeePaymentTransactionTableDB.GetList(StudentFeeKey, PaymentRefKey);
        }

        /// <summary>
        /// Gets a single StudentFeePaymentTransactionTable from the database without its data.
        /// </summary>
        /// <param name="sFPTKey">The SFPTKey of the StudentFeePaymentTransactionTable in the database.</param>
        /// <returns>A StudentFeePaymentTransactionTable object when the SFPTKey exists in the database, or <see langword="null"/> otherwise.</returns>
        [DataObjectMethod(DataObjectMethodType.Select, false)]
        public static StudentFeePaymentTransactionTable GetItem(long sFPTKey)
        {
            return GetItem(sFPTKey, false);
        }

        /// <summary>
        /// Gets a single StudentFeePaymentTransactionTable from the database.
        /// </summary>
        /// <param name="sFPTKey">The SFPTKey of the StudentFeePaymentTransactionTable in the database.</param>
        /// <param name="getStudentFeePaymentTransactionTableRecords">Determines whether to load all associated StudentFeePaymentTransactionTable records as well.</param>
        /// <returns>
        /// A StudentFeePaymentTransactionTable object when the SFPTKey exists in the database, or <see langword="null"/> otherwise.
        /// </returns>
        [DataObjectMethod(DataObjectMethodType.Select, false)]
        public static StudentFeePaymentTransactionTable GetItem(long sFPTKey, bool getStudentFeePaymentTransactionTableRecords)
        {
            StudentFeePaymentTransactionTable myStudentFeePaymentTransactionTable = StudentFeePaymentTransactionTableDB.GetItem(sFPTKey);
            return myStudentFeePaymentTransactionTable;
        }

        /// <summary>
        /// Saves a StudentFeePaymentTransactionTable in the database.
        /// </summary>
        /// <param name="myStudentFeePaymentTransactionTable">The StudentFeePaymentTransactionTable instance to save.</param>
        /// <returns>The new SFPTKey if the StudentFeePaymentTransactionTable is new in the database or the existing SFPTKey when an item was updated.</returns>
        [DataObjectMethod(DataObjectMethodType.Update, true)]
        public static long Save(StudentFeePaymentTransactionTable myStudentFeePaymentTransactionTable)
        {
            using (TransactionScope myTransactionScope = new TransactionScope())
            {
                long studentFeePaymentTransactionTableSFPTKey = StudentFeePaymentTransactionTableDB.Save(myStudentFeePaymentTransactionTable);

                //  Assign the StudentFeePaymentTransactionTable its new (or existing SFPTKey).
                myStudentFeePaymentTransactionTable.SFPTKey = studentFeePaymentTransactionTableSFPTKey;

                myTransactionScope.Complete();

                return studentFeePaymentTransactionTableSFPTKey;
            }
        }

        /// <summary>
        /// Deletes a StudentFeePaymentTransactionTable from the database.
        /// </summary>
        /// <param name="myStudentFeePaymentTransactionTable">The StudentFeePaymentTransactionTable instance to delete.</param>
        /// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
        [DataObjectMethod(DataObjectMethodType.Delete, true)]
        public static bool Delete(StudentFeePaymentTransactionTable myStudentFeePaymentTransactionTable)
        {
            return StudentFeePaymentTransactionTableDB.Delete(myStudentFeePaymentTransactionTable.SFPTKey);
        }

        #endregion

    }

}
